<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        $abc=1;
        echo "<br/> 1  =>".gettype($abc);
        $abc="abc";
        echo "<br/> 1  =>".gettype($abc);
        $abc=True;
        echo "<br/> 1  =>".gettype($abc);
        
        foreach($_POST as $key=>$v){
            echo "<br/>".$key."  ->".$v;
        }
        //$_REQUEST 包含了$_GET和$_POST两个中的参数
        foreach($_REQUEST as $key=>$v){
            echo "<br/>\$_REQUEST  ".$key."  ->".$v;
            echo "<br/>".$_REQUEST[$key];
        }
        foreach($GLOBALS as $k=>$v){
            if(gettype($v)=="string")
            echo "<br/> \$GLOBALS  ".$k."  ->".$v;
        }
        if(isset($GLOBALS["mytitle"])){
        $GLOBALS["mytitle"].="+1";
        }else{
            $GLOBALS["mytitle"]="1234";
        }
        echo "<br/>\$GLOBALS[\"mytitle\"]=".$GLOBALS["mytitle"]."<hr/>";
        //isset() 判断一个变量有没有定义，并且是不是为空
//        echo "\$_POST[\"username\"] -->".isset($_POST["username"]);
        //如果参数 username不存在，就使用默认值0
        $uname=isset($_POST["username"])?$_POST["username"]:"0";
        $upwd=isset($_POST["upasswd"])?$_POST["upasswd"]:"0";
        if($uname=="abc"&&$upwd==123456)
        {
            echo "<h1>登录成功</h1>";
        }else{
             echo "<h1>用户名或者密码错误！</h1>";
        }
        
        ?>
    </body>
</html>
